#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using webapp4U.DAL;
#endregion


namespace webapp4U.BOL
{
	 public class Contact : BizObject
	 {
	     #region Member Variables

	     private Int32 _contactID;

	     private Int32 _cateID;

	     private String _fullName;

	     private String _address;

	     private String _tel;

	     private String _email;

	     private String _title;

	     private String _content;

	     private DateTime _addedDate;

	     private Int32 _viewStatus;

	     #endregion



	     #region Public Properties

	     public Int32 ContactID
	     {
		     get { return _contactID; }
		     set { _contactID = value; }
	     }

	     public Int32 CateID
	     {
		     get { return _cateID; }
		     set { _cateID = value; }
	     }

	     public String FullName
	     {
		     get { return _fullName; }
		     set { _fullName = value; }
	     }

	     public String Address
	     {
		     get { return _address; }
		     set { _address = value; }
	     }

	     public String Tel
	     {
		     get { return _tel; }
		     set { _tel = value; }
	     }

	     public String Email
	     {
		     get { return _email; }
		     set { _email = value; }
	     }

	     public String Title
	     {
		     get { return _title; }
		     set { _title = value; }
	     }

	     public String Content
	     {
		     get { return _content; }
		     set { _content = value; }
	     }

	     public DateTime AddedDate
	     {
		     get { return _addedDate; }
		     set { _addedDate = value; }
	     }

	     public Int32 ViewStatus
	     {
		     get { return _viewStatus; }
		     set { _viewStatus = value; }
	     }

	     #endregion

	     #region public static Methods
	     public static int Insert(Contact obj)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.Insert(obj);
	     }

	     public static bool Update(Contact obj)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.Update(obj);
	     }

	     public static bool Delete(Int32 ContactID)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.Delete(ContactID); 
	     }

	     public static Contact GetContactByID(Int32 ContactID)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.GetContactByID(ContactID);
	     }

	     //Get All Contact
	     public static List<Contact> GetAllContact(int PageIndex, int PageSize)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.GetAllContact(PageIndex, PageSize);
	     }

	     // Get Count All records of Table  Contact
	     public static int GetCountContact()
	     {
		     ContactDAL db = new ContactDAL();
		     return db.GetCountContact();
	     }

         // Get ContactByCateID
         public static List<Contact> GetContactByCateID(Int32 CateID)
         {
             ContactDAL db = new ContactDAL();
             return db.GetContactByCateID(CateID, 1, MAXROWS);
         }


	     // Get ContactByCateID
	     public static List<Contact> GetContactByCateID(Int32 CateID,int PageIndex, int PageSize)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.GetContactByCateID(CateID, PageIndex, PageSize);
	     }

	     // Get ContactCountByCateID
	     public static int GetContactCountByCateID(Int32 CateID)
	     {
		     ContactDAL db = new ContactDAL();
		     return db.GetContactCountByCateID(CateID);
	     }

	     #endregion
	 }
}
